CKEDITOR.dialog.add('flvPlayer', function(editor) {
	var escape = function(value) {
		return value;
	};
	return {
		title : '插入Flv视频',
		resizable : CKEDITOR.DIALOG_RESIZE_BOTH,
		minWidth : 410,
		minHeight : 300,
		contents : [ {
			id : 'info',
			label : '常规',
			accessKey : 'P',
			elements : [ {
				type : 'hbox',
				widths : [ '80%' ],
				children : [ {
					id : 'mserver',
					type : 'text',
					label : 'RTMP流媒体服务 [ 例: rtmp://192.168.1.18/vod ]   (对于非流媒体服务,此处不填.)',
					'default':'rtmp://'
				}]
			},{
				type : 'hbox',
				widths : [ '80%' ],
				children : [{
					id : 'srcfile',
					type : 'text',
					label : '视频文件'
				}, {
					type : 'button',
					id : 'browsefile',
					filebrowser : 'info:srcfile',
					hidden : true,
					align : 'center',
					label : '浏览服务器'
				}]
			},{
				type : 'hbox',
				widths : [ '80%', '20%' ],
				children : [ {
					id : 'imgsrc',
					type : 'text',
					label : '预览图'
				}, {
					type : 'button',
					id : 'browse',
					filebrowser : 'info:imgsrc',
					hidden : true,
					align : 'center',
					label : '浏览服务器'
				}]
			},{
				type : 'hbox',
				widths : [ '35%', '35%', '30%' ],
				children : [ {
					type : 'text',
					label : '视频宽度',
					id : 'v_width',
					'default' : '600',
					style : 'width:50px'
				}, {
					type : 'text',
					label : '视频高度',
					id : 'v_height',
					'default' : '400',
					style : 'width:50px'
				}, {
					type : 'select',
					label : '自动播放',
					id : 'autostart',
					required : true,
					'default' : 'false',
					items : [ [ '是', 'true' ], [ '否', 'false' ] ]
				} ]
			//children finish  
			}, {
				type : 'html',
				html : '',
				label : '预览',
				id : 'preview'
			} ]
		}],
		onOk : function() {
			v_width = this.getValueOf('info', 'v_width');
			v_height = this.getValueOf('info', 'v_height');
			autostart = this.getValueOf('info', 'autostart');
			mserver = this.getValueOf('info', 'mserver');
			if(mserver=='rtmp://')
				mserver='';
			srcfile=this.getValueOf('info','srcfile');
			myimgsrc = this.getValueOf('info', 'imgsrc');
			mserver = escape(mserver);
			srcfile=escape(srcfile);
			myimgsrc=escape(myimgsrc);
			//editor.insertHtml("<pre class=\"brush:" + lang + ";\">" + html + "</pre>");  
			var d=new Date();
			var str="<div id='"+d.getTime()+"'>视频播放器 ...</div>";
			str+="<script type='text/javascript'>";
			str+="    jwplayer('"+d.getTime()+"').setup({";
			str+="    'flashplayer': '"+CKEDITOR.basePath+"plugins/flvPlayer/dialogs/player.swf',";
			str+="    'file': '"+srcfile+"',";
			str+="    'streamer': '"+mserver+"',";
			str+="    'image': '"+myimgsrc+"',";
			str+="    'controlbar': 'bottom',";
			str+="    'autostart': '"+autostart+"',";
			str+="    'width': '"+v_width+"',";
			str+="    'height': '"+v_height+"'";
			/*str+="    jwplayer(\""+d.getTime()+"\").setup({";
			str+="    file:\""+html+"\",";
			str+="    image:\""+html2+"\",";
			str+="    height:"+v_height+",";	        
			str+="    width:"+v_width+",";
			str+="    autostart:"+autostart;*/
			str+=" });";
			str+="</script>";
			jwplayer("").setup()
			editor.insertHtml(str);
		},
		onLoad : function() {
		}
	};
});